*** DO FOR DATA PRESENTATION ARTICLE ON ISSUES ***
*** 2023-01-06
*** updated 2023-08-01

use "UCDPCID_replicationdata_JCR.dta"

gen bd_best_log = log(bd_best)

gen issue_dynamics_log = log(1+issue_dynamics)

sort dyad_id year
by dyad_id: gen bd_lag = bd_best_log[_n-1]


** MODELLING ***

** IN FORCE 2/8 2023

xtset gwno_loc


*Model 1 (fixed effects)
xtnbreg bd_best bd_lag issue_dynamics_log ext_sup discrimpop exclpop v2x_polyarchy log_pop log_gdppc, fe

estimates store Model1

*Model 2 (clustered standard errots)

nbreg bd_best bd_lag issue_dynamics_log ext_sup discrimpop exclpop v2x_polyarchy log_pop log_gdppc, cluster(gwno_loc)

estimates store Model2


** CREATES COEFPLOT FOR FIGURE 9

coefplot Model1 Model2, bylabel(M1-2 (controls))  ///
       ||, drop(_cons) xline(0) graphregion(color(white)) ciopts(color(black))


** SIMULATE EFFECT **

estsimp nbreg bd_best issue_dynamics_log ext_sup discrimpop exclpop v2x_polyarchy log_pop log_gdppc, cluster(gwno_loc)


setx issue_dynamics_log 0
simqi

setx issue_dynamics_log 1.1
simqi

setx issue_dynamics_log 2.8
simqi

setx issue_dynamics_log 1.7
simqi

drop b1 b2 b3 b4 b5 b6 b7 b8 b9 



